define([],function(){
	var tpl = {};

	tpl.foodLibirayTab = function(){
		var html = "";
		html += tab();
		return html;
	}
	tpl.foodMenus = function(){
		var html = "";
		html += foodMenus();
		return html;
	}
	/*tpl.nutrientList = function(){
		var html = "";
		html += nutrientList();
		return html;
	}*/
	tpl.nutrientList2 = function(){
		var html = "";
		html += nutrientList2();
		return html;
	}
	tpl.nutrientListAppend = function(){
		var html = "";
		html += nutrientListAppend();
		return html;
	}
	tpl.nutrientUnit = function(){
		var html = "";
		html += nutrientUnit();
		return html;
	}
	tpl.contextMenu = function(){
		var html = "";
		html += contextMenu();
		return html;
	}
	tpl.modifyFoodClassifyForm = function(){
		var html = "";
		html += modifyFoodClassifyForm();
		return html;
	}
	tpl.editFoodBox = function(){
		var html = "";
		html += editFoodBox();
		return html;
	}

	var tab = function(){
		return 	'<scprit id="editFood_foodLibirayTab" type="text-html">'+
				'   <select>'+
                '       {{each list as value i}}'+
                '			{{if value.selected}}'+
                '           	<option value="{{value.foodLibraryId}}" selected>{{value.foodLibraryName}}</option>'+
                '			{{else}}'+
                '           	<option value="{{value.foodLibraryId}}">{{value.foodLibraryName}}</option>'+
                '			{{/if}}'+
                '       {{/each}}'+
                '   </select>'+
				'</scprit>';
	}

	var foodMenus = function(){
		return 	'<scprit id="editFood_foodMenus" type="text-html">'+
				'	{{if list.length == 0}}'+
				'		<div class="tip-null">右击该空白处可添加食品以及食品分类！</div>'+
				'	{{else}}'+
				'		<ul class="ztree" id="ztreeFoodLibiray"></ul>'+
				'	{{/if}}'+
				'</scprit>';
	}

	var contextMenu = function(){
		return 	'<scprit id="editFood_contextMenu" type="text-html">'+
				'   <ul class="dropdown-menu" role="menu">'+
                '       {{if flag == "foodClassify"}}'+
                '       <li class="rename">'+
                '           <a tabindex="-1" href="javascript:void(0);"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>重命名</a>'+
                '       </li>'+
                '       <li class="addSubClassify">'+
                '           <a tabindex="-1" href="javascript:void(0);"><i class="fa fa-list" aria-hidden="true"></i>添加子分类</a>'+
                '       </li>'+
                '       <li class="addRootClassify">'+
                '           <a tabindex="-1" href="javascript:void(0);"><i class="fa fa-th-large" aria-hidden="true"></i>添加根分类</a>'+
                '       </li>'+
                '       <li class="remove">'+
                '           <a tabindex="-1" href="javascript:void(0);"><i class="fa fa-trash" aria-hidden="true"></i>删除</a>'+
                '       </li>'+
                '       {{/if}}'+
                '       {{if flag == "food"}}'+
                '       <li class="remove">'+
                '           <a tabindex="-1" href="javascript:void(0);"><i class="fa fa-trash" aria-hidden="true"></i>删除</a>'+
                '       </li>'+
                '       {{/if}}'+
                '       {{if flag == "blank"}}'+
                '       <li class="addRootClassify">'+
                '           <a tabindex="-1" href="javascript:void(0);"><i class="fa fa-th-large" aria-hidden="true"></i>添加根分类</a>'+
                '       </li>'+
                '       {{/if}}'+
                '   </ul>'+
				'</scprit>';
	}
	var modifyFoodClassifyForm = function(){
        return  '<script id="editFood_modifyFoodClassifyForm" type="text/html">'+
                '   <form class="form-horizontal">'+
                '       <div class="form-group">'+
                '           <label class="col-sm-3 control-label"><i class="not-null">*</i>名称</label>'+
                '           <div class="col-sm-8">'+
                '               <input type="text" name="name" class="form-control" value="{{name}}" placeholder="请输入名称">'+
                '           </div>'+
                '       </div>'+
                '       <div class="form-group">'+
                '           <label class="col-sm-3 control-label">备注</label>'+
                '           <div class="col-sm-8">'+
                '               <input type="text" name="remark" class="form-control" placeholder="请输入备注">'+
                '           </div>'+
                '       </div>'+
                '       <div class="form-group">'+
                '           <div class="col-sm-offset-3 col-sm-8">'+
                '               <div id="modifyFoodClassifyBtn" class="btn btn-info">添加</div>'+
                '           </div>'+
                '       </div>'+
                '   </form>'+
                '</script>';
    };
    var editFoodBox = function(){
    	return  '<script id="editFood_editFoodBox" type="text/html">'+
    			'	<div class="panel panel-default">'+
	            '    	<div class="panel-heading">{{tit}}</div>'+
	            '    	<div class="panel-body">'+
	            '        	<div class="add-food form-horizontal clearfix">'+
	            '            	<div class="form-group col-md-3 col-lg-3 grid-label-2">'+
	            '                	<label for="foodName" class="control-label">名称</label>'+
	            '                	<div class="control-input">'+
	            '                    	<input id="foodName" foodId="{{data.foodId}}" type="text" class="form-control" value="{{data.foodName}}">'+
	            '                	</div>'+
	            '            	</div>'+
	            '            	<div class="form-group col-md-3 col-lg-3 grid-label-2">'+
	            '                	<label for="foodUnit" class="control-label">单位</label>'+
	            '                	<div class="control-input">'+
	            '                    	<input id="foodUnit" type="text" class="form-control" value="{{data.foodUnit}}">'+
	            '                	</div>'+
	            '            	</div>'+
	            '            	<div class="form-group col-md-3 col-lg-3 grid-label-4">'+
	            '                	<label for="foodContent" class="control-label">单位重量</label>'+
	            '                	<div class="control-input">'+
	            '                    	<input id="foodContent" type="number" class="form-control" value="{{data.foodContent}}">'+
	            '                	</div>'+
	            '            	</div>'+
	            '            	<div class="form-group col-md-3 col-lg-3 grid-label-2">'+
	            '                	<label class="control-label">类别</label>'+
	            '                	<div class="control-input">'+
	            '						<p class="form-control" id="foodTypeId" foodTypeId="{{data.foodTypeId}}">{{data.foodTypeName}}</p>'+
	            /*'                    	<select name="type" id=""  class="form-control">'+
	            '                        	<option value=""></option>'+
	            '                    	</select>'+*/
	            '                	</div>'+
	            '            	</div>'+
	            '        	</div>'+
	            '        	<div class="add-nutrient">'+
	            '			 	<div class="nutrient-tit">营养素 <button class="pull-right btn btn-info" id="addNutrientBtn">点击选择要添加的营养素</button></div>'+
				'				<div class = "clearfix addNutrient_show" id="addNutrient_show"></div>'+
                '			 	<table id="nutrientTable" class="table table-bordered table-condensed">'+
                '			       	<thead>'+
                '			           	<tr>'+
                '			               	<th>营养素名称</th>'+
                '			               	<th>营养素单位量</th>'+
                '			           	</tr>'+
                '			       	</thead>'+
                '			       	<tbody>'+
                '						{{each data.nutrients as value i}}'+
                '						<tr class="original-tr" nutrientsCode="{{value.nutrientsCode}}" nutrientsId="{{value.nutrientsId}}" nutrientsValue="{{value.nutrientsValue}}">'+
			    '				           	<td>{{value.nutrientsName}}<i class="fa fa-minus del-nutrient"></i></td>'+
			    '				           	<td>{{value.nutrientsValue}}({{value.nutrientsUnit}})</td>'+
			    '				       	</tr>'+
			    '						{{/each}}'+
                '			    	</tbody>'+
                '			       	<tfoot>'+
                '			           	<tr>'+
                '			               	<td colspan="2" class="add-nutrient-btn" id="saveNutrientBtn">'+
                '			                   	<i class="fa fa-floppy-o" aria-hidden="true"></i> 保存'+/*fa fa-plus*/
                '			               	</td>'+
                '			           	</tr>'+
                '			       </tfoot>'+
                '			 	</table>'+
	            '		 	</div>'+
	            '   	</div>'+
	            '	</div>'+
    			'</script>';
    }

  /*  var nutrientList = function(){
		return 	'<scprit id="editFood_nutrientList" type="text-html">'+
			   	'	<select>'+
			   	'		{{each list as value i}}'+
			    '			<option value="{{value.nutrientsId}}" nutrientsCode="{{value.nutrientsCode}}" nutrientsUnit="{{value.nutrientsUnit}}">{{value.nutrientsName}}</option>'+
			    '		{{/each}}'+
			   	'   </select>'+
			    '</scprit>';
	}*/
	var nutrientList2 = function(){
		return 	'<scprit id="editFood_nutrientList2" type="text-html">'+
				'<div class="clearfix">'+
			   	'	{{each list as value i}}'+
				'		<div class="checkbox">'+
			   	'			<label>'+
				'				{{if value.flag}}'+
			    '				<input type="checkbox" class="form-control" flag ="{{value.flag}}" checked="checked" disabled name = "check_nutrient" nutrientsId="{{value.nutrientsId}}" value = "{{value.nutrientsName}}" nutrientsCode="{{value.nutrientsCode}}" nutrientsUnit="{{value.nutrientsUnit}}">{{value.nutrientsName}}'+
				'				{{else}}'+
				'				<input type="checkbox" class="form-control"  name = "check_nutrient" nutrientsId="{{value.nutrientsId}}" value = "{{value.nutrientsName}}" nutrientsCode="{{value.nutrientsCode}}" nutrientsUnit="{{value.nutrientsUnit}}">{{value.nutrientsName}}'+
				'				{{/if}}'+
				'			</label>'+
				'		</div>'+
			    '	{{/each}}'+
				'</div>'+
			    '<div class="clearfix"><button class="btn btn-info" id="checkAll">全选</button><button class="btn btn-info pull-right" id="sureAddNutrient">确定添加</button></div>'+
			    '</scprit>';
	}
	var nutrientListAppend = function(){
		return 	'<scprit id="editFood_nutrientListAppend" type="text-html">'+
		'<tbody>'+
				'	{{each data as value i}}'+
                '		<tr class="original-tr" nutrientsCode="{{value.nutrientsCode}}" nutrientsId="{{value.nutrientsId}}" nutrientsValue="{{value.nutrientsValue}}">'+
			    '			<td>{{value.nutrientsName}}<i class="fa fa-minus del-nutrient"></i></td>'+
			    '			<td><input type="number"><span>{{value.nutrientsUnit}}</span></td>'+
			    '		</tr>'+
			    '	{{/each}}'+
			    '</tbody>'+
			    '</scprit>';
	}
	var nutrientUnit = function(){
		return 	'<scprit id="editFood_nutrientUnit" type="text-html">'+
			   	'   <input type="number"><span>{{list[0].nutrientsUnit}}</span>'+
			    '</scprit>';
	}

	return tpl;
});